package zhoug.demo.zui;

import android.os.Bundle;
import android.view.View;

import java.util.Arrays;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.OrientationHelper;
import androidx.recyclerview.widget.RecyclerView;
import zhoug.common.adapters.recycler.BaseRecyclerViewAdapter;
import zhoug.common.adapters.recycler.TextAdapter;
import zhoug.common.adapters.recycler.dividers.ListItemDecoration;
import zhoug.common.router.Router;
import zhoug.common.utils.ToastUtils;
import zhoug.demo.zui.ui.AlignTextViewActivity;
import zhoug.demo.zui.ui.ArcLinearLayoutActivity;
import zhoug.demo.zui.ui.AutoCompleteActivity;
import zhoug.demo.zui.ui.BadgeViewActivity;
import zhoug.demo.zui.ui.BannerActivity;
import zhoug.demo.zui.ui.CalendarViewActivity;
import zhoug.demo.zui.ui.ChinaMapActivity;
import zhoug.demo.zui.ui.DashboardViewActivity;
import zhoug.demo.zui.ui.ExpandButtonActivity;
import zhoug.demo.zui.ui.FlowViewGroupActivity;
import zhoug.demo.zui.ui.KeyboardActivity;
import zhoug.demo.zui.ui.MarqueeActivity;
import zhoug.demo.zui.ui.MenuGroupActivity;
import zhoug.demo.zui.ui.NumberPickerActivity;
import zhoug.demo.zui.ui.ProgressActivity;
import zhoug.demo.zui.ui.RoundIndicatorViewActivity;
import zhoug.demo.zui.ui.SelectListActivity;
import zhoug.demo.zui.ui.ShapeActivity;
import zhoug.demo.zui.ui.StepNumberActivity;
import zhoug.demo.zui.ui.SwipeMenuLayoutActivity;
import zhoug.demo.zui.ui.TestAutoCompleteActivity;
import zhoug.demo.zui.ui.TestDialogActivity;
import zhoug.demo.zui.ui.TestZUIAbsKeyValueAlignViewActivity;
import zhoug.demo.zui.ui.TestZUIAutoCompleteTextActivity;
import zhoug.demo.zui.ui.TestZUIEmptyViewActivity;
import zhoug.demo.zui.ui.TestZUIRecyclerViewActivity;
import zhoug.demo.zui.ui.TreeMenuActivity;
import zhoug.demo.zui.ui.ValuePairActivity;
import zhoug.demo.zui.ui.WaveProgressViewActivity;
import zhoug.demo.zui.ui.ZUICircleProgressActivity;
import zhoug.demo.zui.ui.ZUIDatePickerActivity;
import zhoug.demo.zui.ui.ZUIExpandViewActivity;
import zhoug.demo.zui.ui.ZUIFilePreviewActivity;
import zhoug.demo.zui.ui.ZUIInputViewMainActivity;
import zhoug.demo.zui.ui.ZUIMultiDateChooserActivity;
import zhoug.demo.zui.ui.ZUIPieChartActivity;
import zhoug.demo.zui.ui.ZUIRadioGroupActivity;
import zhoug.demo.zui.ui.ZUISearchViewActivity;
import zhoug.demo.zui.ui.ZUITaskFlowActivity;
import zhoug.demo.zui.ui.ZUITaskTimeFlowViewActivity;
import zhoug.demo.zui.ui.ZUITextViewActivity;
import zhoug.demo.zui.ui.ZUITipDialogActivity;

public class ZuiActivity extends AppCompatActivity {
    private RecyclerView mRecyclerView;
    private List<PageBean> data= Arrays.asList(
            new PageBean("ZUIExpandView(收缩展开控件)", ZUIExpandViewActivity.class),
            new PageBean("ZUISearchView(搜索框)", ZUISearchViewActivity.class),
            new PageBean("选择列表", SelectListActivity.class),
            new PageBean("ZUIInputView", ZUIInputViewMainActivity.class),
            new PageBean("ZUINumberStepView(步进器)", StepNumberActivity.class),
            new PageBean("ZUIFilePreview(文件预览列表)", ZUIFilePreviewActivity.class),
            new PageBean("ZUITaskTimeFlowView(任务流程图)", ZUITaskTimeFlowViewActivity.class),
            new PageBean("ZUINumberPicker", NumberPickerActivity.class),
            new PageBean("日期选择器", ZUIDatePickerActivity.class),
            new PageBean("ZUIMultiDateChooser(开始时间结束时间选择器)", ZUIMultiDateChooserActivity.class),
            new PageBean("ZUICalendarView", CalendarViewActivity.class),
            new PageBean("ZUIAutoCompeteTextView(输入自动补全)", TestZUIAutoCompleteTextActivity.class),
            new PageBean("ZUIRecyclerView", TestZUIRecyclerViewActivity.class),
            new PageBean("ZUIEmptyView", TestZUIEmptyViewActivity.class),
            new PageBean("ZUIAbsKeyValueAlignView", TestZUIAbsKeyValueAlignViewActivity.class),
            new PageBean("ZUIAlignTextView", AlignTextViewActivity.class),
            new PageBean("ZUIFlowViewGroup", FlowViewGroupActivity.class),
            new PageBean("Dialog", TestDialogActivity.class),
            new PageBean("ZUITextView", ZUITextViewActivity.class),
            new PageBean("ZUITipDialog", ZUITipDialogActivity.class),
            new PageBean("ZUIAutoComplete", AutoCompleteActivity.class),
            new PageBean("ZUIAutoCompleteTextView", TestAutoCompleteActivity.class),
            new PageBean("ZUIRoundIndicatorView(指示器)", RoundIndicatorViewActivity.class),
            new PageBean("ZUIAbsKeyValueView", ValuePairActivity.class),
            new PageBean("ZUIExpandButton", ExpandButtonActivity.class),
            new PageBean("ZUIProgress", ProgressActivity.class),
            new PageBean("ZUISwipeMenuLayout(侧滑删除)", SwipeMenuLayoutActivity.class),
            new PageBean("ZUIBadgeView", BadgeViewActivity.class),
            new PageBean("ZUIBanner", BannerActivity.class),
            new PageBean("ZUIChinaMapView", ChinaMapActivity.class),
            new PageBean("ZUIMenuGroup", MenuGroupActivity.class),

            new PageBean("ZUITreeMenu", TreeMenuActivity.class),
            new PageBean("ZUIArcLinearLayout", ArcLinearLayoutActivity.class),
            new PageBean("ZUICircleProgress(圆形进度)", ZUICircleProgressActivity.class),
            new PageBean("WaveProgressView(水球图)", WaveProgressViewActivity.class),
            new PageBean("DashboardView(仪表盘)", DashboardViewActivity.class),
            new PageBean("ZUIShape(形状)", ShapeActivity.class),
            new PageBean("ZUIPieChartView(饼图)", ZUIPieChartActivity.class),
            new PageBean("ZUITaskFlowView(任务进度流程图)", ZUITaskFlowActivity.class),
            new PageBean("自定义软键盘", KeyboardActivity.class),
            new PageBean("支持多行的RadioGroup", ZUIRadioGroupActivity.class),
            new PageBean("跑马灯", MarqueeActivity.class)
    );

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zui);
        findViews();

        TextAdapter<PageBean> adapter=new TextAdapter<PageBean>() {
            @Override
            public String getText(PageBean bean) {
                return bean.text;
            }
        };
        adapter.setData(data);

        adapter.setOnItemClickListener(new BaseRecyclerViewAdapter.OnItemClickListener<PageBean>() {
            @Override
            public void onItemClick(BaseRecyclerViewAdapter<PageBean> adapter, View view, int position) {
                PageBean itemData = adapter.getItemData(position);
                if(itemData.cls!=null){
                    Router.navigation(ZuiActivity.this,itemData.cls);
                }else{
                    ToastUtils.toastLongCenter(getApplicationContext(),"没有配置页面");
                }
            }
        });

        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new ListItemDecoration(this, OrientationHelper.VERTICAL));
        mRecyclerView.setAdapter(adapter);

    }

    private void findViews() {
        mRecyclerView = findViewById(R.id.recyclerView);
    }
}